package com.hzit.service.impl;

import com.hzit.entity.Student;
import com.hzit.mapper.StudentMapper;
import com.hzit.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements IStudentService {
	@Autowired
	private StudentMapper studentMapper;
	//1. 查询所有学生
	@Override
	public List<Student> findAll() {
		return studentMapper.selectByExample(null);
	}

	//2. 添加学生
	@Override
	public void add(Student student) {
		studentMapper.insert(student);
	}

	//3. 修改学生
	@Override
	public void update(Student student) {
		studentMapper.updateByPrimaryKey(student);
	}

	//4. 删除学生
	@Override
	public void delete(int sid) {
		studentMapper.deleteByPrimaryKey(sid);
	}
}
